//
//  CXAdvertisementTableViewCell.m
//  Delicious
//
//  Created by dllo on 15/11/26.
//  Copyright © 2015年 doll. All rights reserved.
//

#import "CXAdvertisementTableViewCell.h"
#import "UIImageView+WebCache.h"

@interface CXAdvertisementTableViewCell ()

@property (nonatomic, retain) UIImageView *img;

@end

@implementation CXAdvertisementTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.img = [[UIImageView alloc] init];
        [self.contentView addSubview:self.img];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.img.frame = self.contentView.frame;
}

- (void)setDic_advertisement:(NSDictionary *)dic_advertisement
{
    if (_dic_advertisement != dic_advertisement) {
        _dic_advertisement = dic_advertisement;
    }
    [self.img sd_setImageWithURL:[NSURL URLWithString:dic_advertisement[@"photo"]] placeholderImage:[UIImage imageNamed:@""]];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
